#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <type_traits>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
using namespace std;
class A
{
public:
    bool operator()(string s1, string s2)
    {
        return s1[0] < s2[0];
    }
};
vector<string> vv;
map<string, bool> ma;
int n = 0;
int m = 0;
void recursion(int last, int sum, string s, int l)
{
    if (sum == m && ma[s] != true)
    {
        ma[s] = true;
        vv.push_back(s);
        return;
    }
    if (l > n) return;
    for (int i = 1;i <= n;i++)
    {
        if (i > last)
        {
            recursion(i, sum, s, l + 1);
            string tmps = s;
            tmps += to_string(i);
            tmps += ' ';
            recursion(i, sum + i, tmps, l + 1);
            recursion(i, sum, s, l + 1);
        }
    }
    return;
}
int main()
{
    cin >> n >> m;
    cerr << "n=" << n << ",m=" << m << endl;
    recursion(0, 0, "", 1);
    sort(vv.begin(), vv.end(), A());
    for (auto& a : vv)
    {
        cout << a << endl;
        cerr << a << ",size=" << a.size() << endl;
    }
    // for(auto& a:ma)
    // {
    //     cerr<<a.first<<":"<<a.second<<endl;
    // }
    return 0;
}